<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>苹果10￥/斤，折扣 8折</h1>
        请输入您要购买的斤数<input type="text" v-model="goodCatty">
        <button @click="total">结账买单</button>
        <p>结账单：总价:￥{{total}} 折后价:￥{{zhe}} 省了:￥{{sheng}}</p>
    </div>
    <script src="./vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                goodCatty: 0,
            },
            computed:{
                total(){
                    return this.goodCatty *10
                },
                zhe(){
                    return this.total *0.8
                },
                sheng(){
                    return this.total-this.zhe
                }
            }
        })
    </script>
</body>
</html>